﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Collections;

/// <summary>
/// Summary description for HANGXE_BUSSINESS
/// </summary>
public class HANGXE_BUSSINESS
{
    public DataSet ListHangXe(HANGXE_ENTITY hx)
    {
        string ACTION = "LIST";
        return HANGXE_DATAACCESS.GETDATATABLE(ACTION,hx);
    }
    public DataSet TTHangXe(HANGXE_ENTITY hx)
    {
        string ACTION = "GETBYMAHANG";
        return HANGXE_DATAACCESS.GETDATATABLE(ACTION, hx);
    }
    public void ThemHangXe(HANGXE_ENTITY hx)
    {
        string ACTION = "INSERT";
        HANGXE_DATAACCESS.ExcuteQueryString(ACTION, hx);
    }
    public void SuaHangXe(HANGXE_ENTITY hx)
    {
        string ACTION = "UPDATE";
        HANGXE_DATAACCESS.ExcuteQueryString(ACTION, hx);
    }
    public void LuuHangXe(HANGXE_ENTITY hx)
    {
        string ACTION = "SAVE";
        HANGXE_DATAACCESS.ExcuteQueryString(ACTION, hx);
    }
    public void XoaHangXe(HANGXE_ENTITY hx)
    {
        string ACTION = "DELETE";
        HANGXE_DATAACCESS.ExcuteQueryString(ACTION, hx);
    }
    public Hashtable HashListHangXe(HANGXE_ENTITY ot)
    {
        string ACTION = "LIST";
        Hashtable ht = new Hashtable();
        DataSet ds = HANGXE_DATAACCESS.GETDATATABLE(ACTION, ot);
        if (ds.Tables[0].Rows.Count > 0)
        {
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ht.Add(dr["MAHANG"], dr["TENHANG"]);
            }
        }
        return ht;
    }
    public DataSet HashListXeTheoMaHang(OTO_ENTITY ot)
    {
        string ACTION = "LIST_BYMAHANG";
        Hashtable ht = new Hashtable();
        DataSet ds = OTO_DATAACCESS.GETDATATABLE(ACTION, ot);
        return ds;
        //if (ds.Tables[0].Rows.Count > 0)
        //{
        //    foreach (DataRow dr in ds.Tables[0].Rows)
        //    {
        //        ht.Add(dr["MAXE"], dr["TENXE"]);
        //    }
        //}
        //return ht;
    }
   
   
}